﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Devices;
using Devices.Mindray;

namespace DevicesWPF.UCDevices
{
    /// <summary>
    /// UCFF_6450.xaml 的交互逻辑
    /// </summary>
    public partial class UCMindray_BC_30_Vet : UserControl, IUCConfig
    {
        BC_30_Vet info;
        public UCMindray_BC_30_Vet()
        {
            InitializeComponent();
        }
        public UCMindray_BC_30_Vet(BC_30_Vet _info)
        {
            InitializeComponent();
            info = _info;
        }

        /// <summary>
        /// 读取配置
        /// </summary>
        /// <param name="hasErrors"></param>
        /// <returns></returns>
        public  Config GetConfig(out int hasErrors)
        {
            hasErrors = 0;
            BC_30_VetConfig config = (BC_30_VetConfig)info.Config;
            config.CurrentConnectType = config.CurrentConnectType;
            config.IP = textIP.Text;
            int port = 0;
            int.TryParse(textPort.Text, out port);
            config.Port = port;

            return config;
        }

        private void UCMindray_BC_5000Vet_Load(object sender, RoutedEventArgs e)
        {
            if (info != null)
            {
                BC_30_VetConfig config = (BC_30_VetConfig)info.Config;
                textIP.Text = config.IP;
                textPort.Text = config.Port.ToString();
            }

        }
    }
}
